<?php get_header();

$postID = get_the_ID();
$title = get_the_title();

$post->filter = 'sample';
$permalink = get_permalink();

$excerpt = get_the_excerpt();
$content_mail = $excerpt . '%0D%0A%0D%0A' . $permalink;

$post_date = the_date('Y/m/d', '', '', false);

$categories = get_the_category($postID);
$category = reset($categories);

$term_link = get_term_link($category);

?>

<div class="page_title">

    <div class="container">
        <div class="leaft_title"><h3><?php echo $categoriesFirst->name ?></h3></div>
        <div class="reght_pagenation">
            <?php if (function_exists('yoast_breadcrumb')) {
                yoast_breadcrumb('', '');
            } ?>
        </div>
    </div>

</div><!-- end page title -->

<div class="clearfix"></div>

<div class="container">

    <?php if (have_posts()): the_post(); ?>
        <div class="content_left">

            <div class="blog_post">
                <div class="blog_postcontent">
                    <a href="#" class="date"><strong><?php echo date("d", strtotime($post_date)); ?></strong><i>tháng <?php echo date("m", strtotime($post_date)); ?></i></a>

                    <h1><?php echo $title ?></h1>
                    <ul class="post_meta_links">
                        <li>
                            <div class="fb-like" data-href="<?php echo $permalink; ?>" data-send="false" data-layout="button_count" data-width="75" data-show-faces="false"></div>
                        </li>
                        <li>
                            <div class="g-plusone" data-size="tall" data-annotation="inline" data-width="120" data-href="http://asf.com"></div>
                        </li>
                    </ul>

                    <div class="post_info_content">
                        <?php the_content() ?>
                    </div>
                </div>
            </div>
            <!-- /# end post -->

            <div class="clearfix divider_line"></div>

            <div class="one_half last">

                <div class="sharepost">
                    <h4>Chia sẻ qua mạng xã hội</h4>
                    <ul>
                        <li>
                            <a target="_blank" title="Chia sẻ qua Facebook" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $permalink; ?>"><img src="<?php echo THEME_URL ?>/images/blog/facebook.png" alt="facebook-share"/></a>
                        </li>
                        <li>
                            <a target="_blank" title="Chia sẻ qua Twitter" href="https://twitter.com/intent/tweet?source=webclient&text=<?php echo $permalink . "+" . $title; ?>"><img src="<?php echo THEME_URL ?>/images/blog/twitter.png" alt="twitter-share"/></a>
                        </li>
                        <li>
                            <a target="_blank" title="Chia sẻ qua Google+" href="https://plus.google.com/share?url={<?php echo $permalink; ?>}"><img src="<?php echo THEME_URL ?>/images/blog/google-plus.png" alt="google-share"/></a>
                        </li>
                    </ul>

                </div>
                <!-- end share post links -->
                <div class="clearfix"></div>

                <div class="popular-posts-area">
                    <h4>Tin liên quan</h4>
                    <ul class="recent_posts_list">
                        <?php $related_posts = Azio_Posts::getPosts(5,$category->term_id,'','',array($postID),'','rand');
                        if($related_posts)
                            foreach($related_posts as $related_post):
                            ?>
                        <li>
                            <span><a href="<?php echo $related_post->permalink ?>" title="<?php echo esc_attr($related_post->post_title) ?>"><img src="<?php echo $related_post->image_avatar ?>" alt="<?php echo esc_attr($related_post->post_title) ?>" width="50" height="50"/></a></span>
                            <a href="<?php echo $related_post->permalink ?>" title="<?php echo esc_attr($related_post->post_title) ?>"><?php echo $related_post->post_title ?></a>
                            <i><?php echo get_the_time( 'm/d/Y G:i', $related_post->ID); ?></i>
                        </li>
    <?php endforeach ?>

                    </ul>

                </div>
            </div>
            <!-- end recent posts -->

            <h4>Comments</h4>

            <div class="mar_top_bottom_lines_small3"></div>

            <div class="fb-comments" data-href="<?php echo $permalink; ?>" data-width="340" data-numposts="5" data-colorscheme="light"></div>
            <!-- end comment form -->

            <div class="clearfix mar_top2"></div>

        </div><!-- end content left area -->


    <?php endif ?>
    <!-- end content left area -->


    <!-- right sidebar starts -->
    <?php get_sidebar('default') ?>
    <!-- end right sidebar -->


</div>


<div class="clearfix"></div>

<?php get_footer() ?>

